/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.mvc.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractFormController;

/**
 * base implementation of {@link AbstractFormController} that need form usage
 * for GET methods.
 */
public abstract class AbstractCustomFormController
    extends AbstractFormController
{

  /**
   * Determine if the given request represents a form submission. Because all
   * request must be considered as form submissions, this method returns always
   * <code>true</code>.
   * 
   * @param request
   *          current HTTP request
   * @return if the request represents a form submission, in this case, always
   *         <code>true</code>
   * @see org.springframework.web.servlet.mvc.AbstractFormController#isFormSubmission(javax.servlet.http.HttpServletRequest)
   */
  @Override
  protected boolean isFormSubmission(HttpServletRequest request)
  {
    return true;
  }



  /**
   * Prepare the form model and view, including reference and error data. Can
   * show a configured form page, or generate a form view programmatically. Here
   * nothing is done because this method is never called.
   * 
   * @param request
   *          current HTTP request
   * @param response
   *          current HTTP response
   * @param bindException
   *          validation errors holder
   * @return the prepared form view, or <code>null</code> if handled directly
   * @see org.springframework.web.servlet.mvc.AbstractFormController#showForm(javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse,
   *      org.springframework.validation.BindException)
   */
  @Override
  protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException bindException)
  {
    // Do nothing
    return null;
  }

}
